package com.example.colorpickdemo.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.colorpickdemo.R;


public class CommonTitleBar extends RelativeLayout
{
    private ImageView ivBack;
    private TextView tvTitle;
    public CommonTitleBar(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
        initLayout(context);
        // TODO Auto-generated constructor stub
    }

    public CommonTitleBar(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        initLayout(context);
        // TODO Auto-generated constructor stub
    }

    public CommonTitleBar(Context context)
    {
        super(context);
        initLayout(context);
        // TODO Auto-generated constructor stub
    }

    private void initLayout(Context context)
    {
        // TODO Auto-generated method stub
        View contentView = LayoutInflater.from(context).inflate(R.layout.common_titlebar, this);
        ivBack = (ImageView) contentView.findViewById(R.id.iv_back);
        tvTitle = (TextView) contentView.findViewById(R.id.tv_title);
    }

    public void setTitle(String title){
        tvTitle.setText(title);
    }

    public void setBackListener(OnClickListener onClickListener){
        ivBack.setOnClickListener(onClickListener);
    }
    

    @Override
    public void setSelected(boolean selected)
    {
        // TODO Auto-generated method stub
        super.setSelected(selected);
    }

}
